<?php
require_once("../admin_config.inc.php");

class setques
{
    private $table = null;
    
    function __construct()
    {
        // create a connection to the database
        $db = connect_db();
        
        $this->table = "setques";
    }
    
    function addSetQues($setid,$ques_id,$option_id)
    {
        $setid = mysql_real_escape_string($setid);
        $ques_id = mysql_real_escape_string($ques_id);
        $option_id = mysql_real_escape_string($option_id);
        
        $data = array(  'setid' => $setid,
                        'ques_id' => $ques_id,
                        'option_id' => $option_id );
                        
        $keys = implode("`,`",array_keys($data));
        $values = implode("','",$data);
        
        $add_query = vsprintf("insert into {$this->table}(`%s`) values('%s')",array($keys,$values));
        $add_res = mysql_query($add_query);
        
        return $add_res;
    }
    
    function delSetQues($set_id,$ques_id)
    {
        $setid = mysql_real_escape_string($set_id);
        $ques_id = mysql_real_escape_string($ques_id);
        
        $del_query = "delete from $this->table where setid = $setid and ques_id = $ques_id";
        $del_res = mysql_query($del_query);
        
        return $del_res;
    }
    function editOption($set_id,$ques_id,$option_id)
    {
        
    }
}
?>
